package com.huanke.iot.base.po.Alarms;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;

@Document(collection = "alarm")
public class Alarms {
  
  @Id
  @Indexed
  private String id;

  /**
   * 模块
   */
  private String module;
  
  /**
   * 方法
   */
  private String method;

  /**
   * 相关参数
   */
  private String parameter;

  /**
   * 告警
   */
  private String alarm;

  /**
   * 告警类型
   */
  private int alarmType;
  
  /**
   * 告警时间
   */
  private Date alarmTime;
  
  /**
   * 告警是否消除
   */
  private boolean handled;


  public Alarms() {
  }

  public Alarms(String module, String method, String parameter, String alarm, int alarmType) {
    this.module = module;
    this.method = method;
    this.parameter = parameter;
    this.alarm = alarm;
    this.alarmType = alarmType;
  }

  public boolean isHandled() {
    return handled;
  }

  public void setHandled(boolean handled) {
    this.handled = handled;
  }

  public String getId() {
    return id;
  }

  public String getAlarm() {
    return alarm;
  }

  public Date getAlarmTime() {
    return alarmTime;
  }

  public void setAlarmTime(Date alarmTime) {
    this.alarmTime = alarmTime;
  }

  public void setId(String id) {
    this.id = id;
  }

  public void setAlarm(String alarm) {
    this.alarm = alarm == null ? "" : alarm;
  }

  public String getModule() {
    return module;
  }

  public void setModule(String module) {
    this.module = module;
  }

  public String getMethod() {
    return method;
  }

  public void setMethod(String method) {
    this.method = method;
  }

  public String getParameter() {
    return parameter;
  }

  public void setParameter(String parameter) {
    this.parameter = parameter;
  }

  public int getAlarmType() {
    return alarmType;
  }

  public void setAlarmType(int alarmType) {
    this.alarmType = alarmType;
  }

  @Override
  public String toString() {
    return "Alarms{" +
            "id='" + id + '\'' +
            ", module='" + module + '\'' +
            ", method='" + method + '\'' +
            ", parameter='" + parameter + '\'' +
            ", alarm='" + alarm + '\'' +
            ", alarmType=" + alarmType +
            ", alarmTime=" + alarmTime +
            ", handled=" + handled +
            '}';
  }
}
